package demo4;

public class Test {
    public static void func(Animal animal){
        animal.eat();
    }
    public static void running(IRunning iRunning){
        iRunning.run();
    }
    public static void swimming(ISwimming iSwimming){
        iSwimming.swim();
    }
    public static void flying(IFly iFly){
        iFly.fly();
    }
    public static void main(String[] args) {
        func(new Dog("旺财",5));
        func(new Fish("泡泡",3));
        func(new Duck("唐老鸭",7));
        System.out.println("=========");
        running(new Dog("旺财",5));
        running(new Duck("唐老鸭",7));
        System.out.println("=========");
        swimming(new Dog("旺财",5));
        swimming(new Duck("唐老鸭",7));
        swimming(new Fish("泡泡",3));
        System.out.println("============");
        flying(new Duck("唐老鸭",7));
    }
}
